import request from '@/utils/request'

// 查询商品库存列表
export function listGoods(query) {
  return request({
    url: '/system/goods/list',
    method: 'get',
    params: query
  })
}

// 查询商品库存详细
export function getGoods(goodsId) {
  return request({
    url: '/system/goods/' + goodsId,
    method: 'get'
  })
}

// 新增商品库存
export function addGoods(data) {
  return request({
    url: '/system/goods',
    method: 'post',
    data: data
  })
}

// 修改商品库存
export function updateGoods(data) {
  return request({
    url: '/system/goods',
    method: 'put',
    data: data
  })
}

// 删除商品库存
export function delGoods(goodsId) {
  return request({
    url: '/system/goods/' + goodsId,
    method: 'delete'
  })
}

// 用户状态修改
export function changeUserStatus(goodsId, status, num, goodsPicture, name, price, sellPrice, date, type, user) {
  const data = {
    goodsId,
    goodsPicture,
    name,
    num,
    price,
    sellPrice,
    date,
    type,
    status,
    user
  }
  return request({
    url: '/system/goods/changeStatus',
    method: 'put',
    data: data
  })
}
